/*******************************************************************
 *
 * Copyright (C), 2021-2022, LS, All rights reserved.
 *
 * Author      : 
 * Create Time : 2021-3-25
 * Version     : v0.1
 * Description : 
 *******************************************************************/
 
/*----------------------------Head file----------------------------*/
#include "wm.h"
#include "string.h"
#include "app_reset.h"
#include "app_skip_alg.h"
#include "app_global_data.h"
#include "user_config.h"

#if(DEV_MAC_BURN_ENABLE)

/*----------------------------macro file---------------------------*/

/*----------------------------type define--------------------------*/

/*----------------------------var define---------------------------*/
static uint8_t burn_done_secs_cnt = 0;

/*-------------------------func declaration------------------------*/

/*-----------------------------------------------------------------*/

static void reset_cb(void)
{
    app_platform_reset();
}

void burn_done_disp_1hz_update(void)
{
    if(burn_done_secs_cnt < 2) {
        burn_done_secs_cnt++;
    }
    else {
        app_platform_reset();
        burn_done_secs_cnt = 0;
    }
}

void wm_burn_enter_disp(void)
{
    wm_t wm;

    memset(&wm, 0, sizeof(wm));
    wm.cur_win = BURN_ING_WIN;
    wm.disp_off_cnt = DISP_NEVER_OFF_CNT;
    wm.long_press_cb = reset_cb;

    wm_info_set(&wm);

    app_skip_mode_set(SKIP_MODE_NULL);

    //app_disp_img_all_clear();
    app_disp_burn_ing();

    wm_set_backlight_off_cnt(DISP_NEVER_OFF_CNT);
    app_disp_backlight_set(true);
}


void wm_burn_done_disp(void)
{
    wm_t wm;

    memset(&wm, 0, sizeof(wm));
    wm.cur_win = BURN_DONE_WIN;
    wm.auto_update_1hz_cb = burn_done_disp_1hz_update;
    wm.disp_off_cnt = DISP_NEVER_OFF_CNT;

    wm_info_set(&wm);

    burn_done_secs_cnt = 0;
    app_disp_img_all_clear();
    /////app_disp_clear();
    /////app_disp_pass();
    //app_disp_update();

    wm_set_backlight_off_cnt(DISP_NEVER_OFF_CNT);
    app_disp_backlight_set(true);
}

#endif
